package com.btcode.schedule;

import java.util.Date;
import java.util.HashMap;
import org.quartz.Trigger.TriggerState;

/**
 * Trigger 是job被调度的机制，许多Trigger可以指向同一个Job，但一个Trigger仅仅能执行一个Job
 *
 * @author gislin
 */
public class TriggerModel {

    private TriggerState state;

    private Date previousFireTime;

    private Date nextFireTime;

    private String name;

    private HashMap<String, Object> dataMap;

    public TriggerState getState() {
        return state;
    }

    public HashMap<String, Object> getDataMap() {
        return dataMap;
    }

    public void setDataMap(HashMap<String, Object> dataMap) {
        this.dataMap = dataMap;
    }

    public void setState(TriggerState state) {
        this.state = state;
    }

    public Date getPreviousFireTime() {
        return previousFireTime;
    }

    public void setPreviousFireTime(Date previousFireTime) {
        this.previousFireTime = previousFireTime;
    }

    public Date getNextFireTime() {
        return nextFireTime;
    }

    public void setNextFireTime(Date nextFireTime) {
        this.nextFireTime = nextFireTime;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        StringBuffer strBuf = new StringBuffer();
        strBuf.append("{");
        strBuf.append("name:");
        strBuf.append(getName());
        strBuf.append(",");
        strBuf.append("state:");
        strBuf.append(getState());
        strBuf.append(",");
        strBuf.append("previousFireTime:");
        strBuf.append(getPreviousFireTime());
        strBuf.append(",");
        strBuf.append("nextFireTime:");
        strBuf.append(getNextFireTime());
        strBuf.append(",");
        strBuf.append("dataMap:");
        strBuf.append(getDataMap());
        strBuf.append("}\r\n");
        return strBuf.toString();
    }
}
